package com.lagou.webwork.model;

import javax.print.DocFlavor;
import java.nio.charset.CharsetDecoder;
import java.util.Arrays;
import java.util.List;

/**
 * @author sjp
 * @date 2021/5/26 19:43
 * @description
 */
public class Result<T> {
    private String code;
    private List<T> dataList;
    private String msg;
    private int totalCount;

    public Result(String code, List<T> dataList, int totalCount, String msg) {
        this.code = code;
        this.dataList = dataList;
        this.totalCount = totalCount;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<T> getDataList() {
        return dataList;
    }

    public void setDataList(List<T> dataList) {
        this.dataList = dataList;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    @Override
    public String toString() {
        return "{" +
                "\"code\":\"" + code +
                "\", \"dataList\":" + Arrays.toString(dataList.toArray()) +
                ", \"totalCount\":\"" + totalCount +
                "\", \"msg\":\"" + msg +
                "\"}";
    }
}
